/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package consumo.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Carlos Taschetto
 */
@Entity
@Table(name = "constantes", catalog = "consumodb", schema = "")
@NamedQueries({
    @NamedQuery(name = "Constantes.findAll", query = "SELECT c FROM Constantes c"),
    @NamedQuery(name = "Constantes.findById", query = "SELECT c FROM Constantes c WHERE c.id = :id"),
    @NamedQuery(name = "Constantes.findByCanal1", query = "SELECT c FROM Constantes c WHERE c.canal1 = :canal1"),
    @NamedQuery(name = "Constantes.findByCanal2", query = "SELECT c FROM Constantes c WHERE c.canal2 = :canal2"),
    @NamedQuery(name = "Constantes.findByCanal3", query = "SELECT c FROM Constantes c WHERE c.canal3 = :canal3")})
public class Constantes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "canal1", precision = 5, scale = 3)
    private BigDecimal canal1;
    @Column(name = "canal2", precision = 5, scale = 3)
    private BigDecimal canal2;
    @Column(name = "canal3", precision = 5, scale = 3)
    private BigDecimal canal3;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "constantes")
    private List<Leitura> leituraList;

    public Constantes() {
    }

    public Constantes(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getCanal1() {
        return canal1;
    }

    public void setCanal1(BigDecimal canal1) {
        this.canal1 = canal1;
    }

    public BigDecimal getCanal2() {
        return canal2;
    }

    public void setCanal2(BigDecimal canal2) {
        this.canal2 = canal2;
    }

    public BigDecimal getCanal3() {
        return canal3;
    }

    public void setCanal3(BigDecimal canal3) {
        this.canal3 = canal3;
    }

    public List<Leitura> getLeituraList() {
        return leituraList;
    }

    public void setLeituraList(List<Leitura> leituraList) {
        this.leituraList = leituraList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Constantes)) {
            return false;
        }
        Constantes other = (Constantes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "consumo.persistence.Constantes[id=" + id + "]";
    }

}
